<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>demo</title>
    <script src="https://unpkg.com/vue@3.0.5/dist/vue.global.js"></script>
  </head>

  <body>
    <div id="app"></div>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            a: 1,
          };
        },
        methods: {
          add(e) {
            this.a++;
            console.log(e.target);
          },
          f2() {
            console.log("执行f2");
          },
        },
        template: `
          <div>
            {{a}}
            <button @click='add'>+1</button>
            <button @click='add($event),f2()'>执行2个方法</button>
          </div>
        `,
      });

      const vm = app.mount("#app");
    </script>
  </body>
</html>
